home *** CD-ROM | disk | FTP | other *** search
- 100 'Points ("POINTS")
- 110 CLS
- 120 COLOR 0,15 : PRINT "Points" : COLOR 15,0
- 130 PRINT
- 140 DEFDBL A-Z
- 150 DEFINT M-N
- 160 ' Let user enter data
- 170 PRINT:PRINT "Do not enter dollar signs or commas"
- 180 PRINT
- 190 INPUT "Amount of loan: ", PNCPL
- 200 INPUT "Annual interest rate (in percent): ", AR
- 210 INPUT "Number of points: ", POINTS
- 220 INPUT "Annual interest rate on savings: ", RSAVINGS
- 230 INPUT "Length of loan (in years): ", NYEARS
- 240 ' Determine lost income from points
- 250 NMONTHS = 12 * NYEARS
- 260 PR = AR / 1200 'Convert to monthly interest rate
- 270 RSAVINGS = (1 + RSAVINGS / 100) ^ (1/12) - 1
- 280 IF POINTS > 0 THEN INCOMELOST = PNCPL * POINTS / 100 * RSAVINGS / ( 1 - (1 + RSAVINGS) ^ -NMONTHS)
- 290 ' Determine amortizing payment
- 300 IF PR <> 0 THEN PMT = PNCPL * PR / (1 - (1 + PR) ^ -NMONTHS) ELSE PMT = PNCPL / NMONTHS
- 310 PMT = PMT + INCOMELOST
- 320 ' Use bisection method to find effective interest rate
- 330 RLOWER = 0 'Initial values
- 340 RUPPER = .5
- 350 WHILE (RUPPER - RLOWER) > .00001
- 360 PR = (RLOWER + RUPPER) / 2
- 370 'Calculate payment for trial value
- 380 TRIALPMT = PNCPL / ( (1 - (1 + PR) ^ -NMONTHS) / PR)
- 390 IF TRIALPMT > PMT THEN RUPPER = PR ELSE RLOWER = PR
- 400 WEND
- 410 ' Print results
- 420 REFFECTIVE = (RUPPER + RLOWER) / 2 * 1200
- 430 PRINT
- 440 PRINT : PRINT "Effective interest rate:"; USING "###.##_%"; REFFECTIVE
- 450 END